
"""
1）过滤出长度大于3的人名
name = ['tom','lily','jacks','Pe','Steven']
2）得到嵌套列表中每个列表的最后一个元素
list1 = [[1,2,3],[4,5,6],[7,8,9]]
3）员工工资>5000的人加200，否则加500
dict1 = {'name':'张三','salary':6000}
dict2 = {'name':'李四','salary':8000}
dict3 = {'name':'王五','salary':4000}
dict4 = {'name':'吴二','salary':3000}
list2 = [dict1,dict2,dict3,dict4]
4）找到分数60分以下的人姓名
scores = {
      "Rick Sanchez": 70,
      "Morty Smith": 35,
      "Summer Smith": 82,
      "Jerry Smith": 23,
      "Beth Smith": 98
    }

"""
name = ['tom', 'lily', 'jacks', 'Pe', 'Steven']
list1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
dict1 = {'name': '张三', 'salary': 6000}
dict2 = {'name': '李四', 'salary': 8000}
dict3 = {'name': '王五', 'salary': 4000}
dict4 = {'name': '吴二', 'salary': 3000}
list2 = [dict1, dict2, dict3, dict4]
scores = {
    "Rick Sanchez": 70,
    "Morty Smith": 35,
    "Summer Smith": 82,
    "Jerry Smith": 23,
    "Beth Smith": 98
}
name1=[i for i in name if len(i)>3]
print(name1)

list11=[i[-1] for i in list1]
print(list11)

li31=[i for i in list2]
li32=[x['salary'] for x in list2]
li33=[x['salary']+200 if x['salary']>5000 else x['salary']+500 for x in list2]
li34=[(x['name'],x['salary']+200 if x['salary']>5000 else x['salary']+500) for x in list2]
print(li34)

list44={key:value for key,value in scores.items() if value<60}
print(list44)